const mongoose = require('mongoose');
let Core = require('../lib/core');

let PositionSchema = mongoose.Schema({
	gps_no: {type: String, index: true},
	longitude: {type: String},
	latitude: {type: String},
	speed: {type: String},
	direction: {type: String},
	add_date: {type: Number},
	protocol_no: {type: String},
	factory_code: {type: String},
	type: {type: String},
	imei: {type: String},
	position: {type: String},
	is_equip: {type: String},
	move_code: {type: String},
	warn_code: {type: String},
	iccd_code: {type: String},
	serial_code: {type: String},
	dg: {type: String},
	sim: {type: String},
	remark: {type: String}
}, {
	collection: 'position'
});

let Position = mongoose.model('position', PositionSchema);

Position.basicAttributes = ['longitude', 'latitude', 'speed', 'direction', 'add_date', 'position'];
Position.detailAttributes = ['gps_no', 'longitude', 'latitude', 'speed', 'direction', 'add_date', 'protocol_no', 'factory_code', 'type',
	'imei', 'position', 'is_equip', 'move_code', 'warn_code', 'iccd_Code', 'serial_code', 'dg', 'sim', 'remark'];

Position.processModel = (model, keys) => {
	model = Core.Util.formatModel(model, keys);

	if (model) {
	}

	return model;
};

module.exports = Position;